import { request } from '@pkg/request/src';

export enum Api {
  page = '/userGoods/page',
  getUserGoodsDetail = '/userGoods/get',
  update = '/userGoods/update',
  remove = '/userGoods/remove',
  backcardSub = '/userGoods/backcardSub',
  delaySub = '/userGoods/delaySub',
  userGoodsUpgradeSub = '/userGoods/userGoodsUpgradeSub',
  frozenSub = '/userGoods/frozenSub',
  syscAirport = '/userGoods/syscAirport',
  nowRefundBackcardSub = '/userGoods/nowRefundBackcardSub',
  employeeUpdate = '/userGoods/employeeUpdate',
  getUserPrivatedata = '/userPrivatedata/get',
  privateDataUpdate = '/userGoods/privateDataUpdate',
  addcheckRecord = '/addcheckRecord/save',
  userGoodsTagBlack = '/userGoods/userGoodsTagBlack',
  getVipcardAgreementUrl = '/userGoods/getVipcardAgreementUrl',
}

enum PayWayApi {
  list = '/payway/list',
}

export const userGoodsPage = (params) =>
  request.get(
    { url: Api.page, params: params },
    {
      errorMessageMode: 'none',
      successMessageMode: 'none',
    },
  );

export const getUserGoodsDetail = (params) =>
  request.get(
    {
      url: Api.getUserGoodsDetail,
      params: params,
    },
    { errorMessageMode: 'none', successMessageMode: 'none' },
  );

export const update = (params) =>
  request.post(
    {
      url: Api.update,
      params: params,
    },
    { errorMessageMode: 'none' },
  );

export const remove = (ids: string) =>
  request.post(
    {
      url: Api.remove,
      params: { ids: ids },
    },
    { errorMessageMode: 'message' },
  );

export const payWayList = (ids: string) =>
  request.get(
    {
      url: PayWayApi.list,
      params: { ids: ids },
    },
    { errorMessageMode: 'none' },
  );

export const backcardSub = (params) =>
  request.post(
    {
      url: Api.backcardSub,
      params: params,
    },
    { errorMessageMode: 'message' },
  );

export const delaySub = (params) =>
  request.post(
    {
      url: Api.delaySub,
      params: params,
    },
    { errorMessageMode: 'message' },
  );

export const userGoodsUpgradeSub = (params) =>
  request.post(
    {
      url: Api.userGoodsUpgradeSub,
      params: params,
    },
    { errorMessageMode: 'message' },
  );
export const frozenSub = (params) =>
  request.post(
    {
      url: Api.frozenSub,
      params: params,
    },
    { errorMessageMode: 'message' },
  );
export const syscAirport = (params) =>
  request.post(
    {
      url: Api.syscAirport,
      params: params,
    },
    { errorMessageMode: 'message' },
  );

export const nowRefundBackcardSub = (params) =>
  request.post(
    {
      url: Api.nowRefundBackcardSub,
      params: params,
    },
    { errorMessageMode: 'message' },
  );
export const employeeUpdate = (params) =>
  request.post(
    {
      url: Api.employeeUpdate,
      params: params,
    },
    { errorMessageMode: 'message' },
  );

export const getUserPrivatedata = (privateDataId) =>
  request.get(
    {
      url: Api.getUserPrivatedata,
      params: { privateDataId: privateDataId },
    },
    { errorMessageMode: 'message', successMessageMode: 'none' },
  );

export const privateDataUpdate = (params) =>
  request.post(
    {
      url: Api.privateDataUpdate,
      params: params,
    },
    { errorMessageMode: 'message' },
  );

export const addcheckRecord = (params) =>
  request.post(
    {
      url: Api.addcheckRecord,
      params: params,
    },
    { errorMessageMode: 'message' },
  );

export const userGoodsTagBlack = (params) =>
  request.post(
    {
      url: Api.userGoodsTagBlack,
      params: params,
    },
    { errorMessageMode: 'message' },
  );
export const getVipcardAgreementUrl = (params) =>
  request.get(
    {
      url: Api.getVipcardAgreementUrl,
      params: params,
    },
    { errorMessageMode: 'message' },
  );
